import http from '/@/utils/http';

/**
 * 公共api接口集合
 * @method getTaskInfoApi 点检任务/获取详情
 * @method getPlanInfoApi 点检计划/获取详情
 * @method batchBuildMaintainPlanApi 点检计划/批量生成点检任务
 * @method deleteMaintainPlanApi 点检计划/删除点检计划
 * @method deletePlanDeviceApi 点检计划/删除指定计划的设备
 * @method saveMaintainPlanApi 点检计划/新增点检计划
 * @method updateMaintainPlanApi 点检计划/修改点检计划
 * @method cancelMaintainTaskApi 点检任务/取消点检任务
 * @method deleteMaintainTaskApi 点检任务/删除点检任务
 * @method derivedMaintainPolicyApi 点检任务/点检单导出
 * @method saveDeviceItemApi 维保,点检项目/新增项目
 * @method updateDeviceItemApi 维保,点检项目/修改项目
 * @method delDeviceItemApi 维保,点检项目/删除项目
 * @method downloadMouldApi 导出模板
 * @method importItemExpertApi 批量导入项目
 * @method checkTransmit 转交点检任务
 * @method getCheckTaskUser 获取当前有点检任务的人员
 */

export const getDJTaskInfoApi = async (params: any) => {
    return await http.get(`/device/mobile/deviceCheckTask/getInfo/${params}`)
}

export const cancelMaintainTaskApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceCheckTask/cancelCheckTask`, params)
}

export const deleteMaintainTaskApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceCheckTask/deleteCheckTask/${id}`)
}

export const derivedMaintainPolicyApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceCheckTask/derivedCheckPolicy`, params)
}

export const saveDeviceItemApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceItem/save`, params)
}
export const updateDeviceItemApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceItem/update`, params)
}

export const delDeviceItemApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceItem/delete/${id}`)
}

export const getPlanInfoApi = async (id: any) => {
    return await http.get(`/device/mobile/deviceCheckPlan/getInfo/${id}`)
}

export const batchBuildMaintainPlanApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceCheckPlan/batchBuildCheckPlan`, params)
}

export const deleteMaintainPlanApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceCheckPlan/deleteCheckPlan/${id}`)
}

export const deletePlanDeviceApi = async (planId: any, deviceId: any) => {
    return await http.put(`/device/mobile/deviceCheckPlan/deletePlanDevice/${planId}/${deviceId}`)
}

export const saveMaintainPlanApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceCheckPlan/saveCheckPlan`, params)
}

export const updateMaintainPlanApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceCheckPlan/updateCheckPlan`, params)
}

export const downloadMouldApi = async (itemType: any) => {
    return await http.postBlob(`/device/mobile/deviceItem/downloadMould/${itemType}`)
}

export const importItemExpertApi = async (itemType: any, file: any) => {
    return await http.postUpload(`/device/mobile/deviceItem/importItemExpert/${itemType}`, file)
}

export const checkTransmit = async (params: any) => {
    return await http.post(`/device/mobile/deviceCheckTask/checkTransmit`, params)
}

export const getCheckTaskUser = async () => {
    return await http.get(`/device/mobile/deviceCheckTask/getCheckTaskUser`)
}